<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("path", basePath);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>类别管理</TITLE>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=path %>/zTree/css/demo.css" type="text/css">
<link rel="stylesheet" href="<%=path %>/zTree/css/tree.css" type="text/css">
	<link rel="stylesheet" href="<%=path %>/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="<%=path %>/zTree/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="<%=path %>/zTree/js/jquery.ztree.core.js"></script>
	 <script type="text/javascript" src="<%=path %>/zTree/js/jquery.ztree.excheck.js"></script>
	  <script type="text/javascript" src="<%=path %>/zTree/js/jquery.ztree.exedit.js"></script>
<SCRIPT type="text/javascript">
		var setting = {				
				data:{
					simpleData:{//注意拼写！！！
						enable:true
					}
				},
				callback:{
					onClick:zTreeOnClick
				}
		};
		
		
		var zNodes =${queryGoodsType};
		/* jquery */
		$(document).ready(function(){
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			 var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
	            var nodes = treeObj.getNodes();
	            for (var i = 0; i < nodes.length; i++) { //设置节点展开
	                treeObj.expandNode(nodes[i], true, false, true);
	            }
		});
		/* callback：点击触发事件 */
		 function zTreeOnClick(event, treeId, treeNode) {
			
			 if(treeNode.pId==null||treeNode.pId==1){
				window.open("queryGoodsTypeByParentId.do?parentId="+treeNode.id,"categoryContent","channelmode=yes");
			}else{
				window.open("getAttribute.do?id="+treeNode.id,"categoryContent","channelmode=yes");
			} 
		  
		} 
		
	</SCRIPT>
</HEAD>

<BODY>
	
<div class="goodstype">
	<div  class="goodstype-left">
	   <ul id="treeDemo" class="ztree" ></ul>
	</div>
	<div  class="goodstype-right">
	   <iframe width="99%" height="99%" src="<%=path %>/goodsType/queryGoodsTypeByParentId.do?parentId=1" name="categoryContent" ></iframe></td>
    </div>	
</div>	
	
</BODY>
</HTML>